package com.tuni.birthdaymoney.service.spring;


import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import com.tuni.birthdaymoney.persistence.entity.Position;
import com.tuni.birthdaymoney.persistence.repository.PositionRepository;
import com.tuni.birthdaymoney.service.PositionService;

@Service
@Transactional
public class SpringPositionService implements PositionService {
    @Autowired
    private PositionRepository positionRepository;

    public PositionRepository getPositionRepository() {
        return positionRepository;
    }

    public void setPositionRepository(PositionRepository positionRepository) {
        this.positionRepository = positionRepository;
    }

    public Position findByName(String name) {

        return positionRepository.findByName(name);
    }

    public Position findByID(Integer id) {

        return positionRepository.findOne(id);
    }

    public Iterable<Position> findAll() {

        return positionRepository.findAll();
    }

    public Position save(Position position) {
        return positionRepository.save(position);
    }

}